]> git.lizzy.rs Git - micro.git/commitdiff
Fix gutter offset when softwrap is enabled
authorZachary Yedidia <zyedidia@gmail.com>
Thu, 13 Feb 2020 16:04:10 +0000 (11:04 -0500)
committerZachary Yedidia <zyedidia@gmail.com>
Thu, 13 Feb 2020 16:04:10 +0000 (11:04 -0500)
internal/action/actions.go
internal/display/bufwindow.go

index b8b0650f4a24a42546a6ac1b17df2b8528b1abfe..16c87b6d58ca56ae6f59c05830125f3cbf669d52 100644 (file)
@@ -283,7 +283,7 @@ func (h *BufPane) SelectWordLeft() bool {
        return true
 }
 
-// StartOfLine moves the cursor to the start of the text of the line
+// StartOfText moves the cursor to the start of the text of the line
 func (h *BufPane) StartOfText() bool {
        h.Cursor.Deselect(true)
        h.Cursor.StartOfText()
@@ -1567,7 +1567,7 @@ func (h *BufPane) SpawnMultiCursorUp() bool {
        return true
 }
 
-// SpawnMultiCursorUp creates additional cursor, at the same X (if possible), one Y more.
+// SpawnMultiCursorDown creates additional cursor, at the same X (if possible), one Y more.
 func (h *BufPane) SpawnMultiCursorDown() bool {
        if h.Cursor.Y+1 == h.Buf.LinesNum() {
                return false
index dd6c7f63795e40d3e4d853ef73a4ddfce6fb746c..fb52728af09b46a5e2b06dbc6ce8278f722816d5 100644 (file)
@@ -275,14 +275,7 @@ func (w *BufWindow) LocFromVisual(svloc buffer.Loc) buffer.Loc {
                                        if vloc.Y >= bufHeight {
                                                break
                                        }
-                                       vloc.X = 0
-                                       if b.Settings["diffgutter"].(bool) {
-                                               vloc.X++
-                                       }
-                                       // This will draw an empty line number because the current line is wrapped
-                                       if b.Settings["ruler"].(bool) {
-                                               vloc.X += maxLineNumLength + 1
-                                       }
+                                       vloc.X = w.gutterOffset
                                }
                        }
                }
@@ -648,6 +641,11 @@ func (w *BufWindow) displayBuffer() {
                                        if b.Settings["diffgutter"].(bool) {
                                                w.drawDiffGutter(lineNumStyle, true, &vloc, &bloc)
                                        }
+
+                                       if hasMessage {
+                                               w.drawGutter(&vloc, &bloc)
+                                       }
+
                                        // This will draw an empty line number because the current line is wrapped
                                        if b.Settings["ruler"].(bool) {
                                                w.drawLineNum(lineNumStyle, true, maxLineNumLength, &vloc, &bloc)