mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-29 22:27:13 +09:00
Fix some quality issues (#1914)
* Add .deepsource.toml * Fix unnecessary typecasting on `bytes.Buffer` * Fix check for empty string * Replace nested if block with else-if * Replace nested if block with else-if * Replaced string.Replace() with string.ReplaceAll where n<0 * Remove deepsource toml file Signed-off-by: siddhant-deepsource <siddhant@deepsource.io> Co-authored-by: DeepSource Bot <bot@deepsource.io> Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
fcc2fea684
commit
cf35b8021c
@@ -1166,7 +1166,7 @@ func (h *BufPane) paste(clip string) {
|
||||
if h.Buf.Settings["smartpaste"].(bool) {
|
||||
if h.Cursor.X > 0 && len(util.GetLeadingWhitespace([]byte(strings.TrimLeft(clip, "\r\n")))) == 0 {
|
||||
leadingWS := util.GetLeadingWhitespace(h.Buf.LineBytes(h.Cursor.Y))
|
||||
clip = strings.Replace(clip, "\n", "\n"+string(leadingWS), -1)
|
||||
clip = strings.ReplaceAll(clip, "\n", "\n"+string(leadingWS))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1349,10 +1349,8 @@ func (h *BufPane) HalfPageDown() bool {
|
||||
v := h.GetView()
|
||||
if h.Buf.LinesNum()-(v.StartLine+v.Height) > v.Height/2 {
|
||||
h.ScrollDown(v.Height / 2)
|
||||
} else {
|
||||
if h.Buf.LinesNum() >= v.Height {
|
||||
v.StartLine = h.Buf.LinesNum() - v.Height
|
||||
}
|
||||
} else if h.Buf.LinesNum() >= v.Height {
|
||||
v.StartLine = h.Buf.LinesNum() - v.Height
|
||||
}
|
||||
h.SetView(v)
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user