File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -1864,7 +1864,7 @@ func (h *BufPane) CommandMode() bool {
18641864
18651865// ToggleOverwriteMode lets the user toggle the text overwrite mode
18661866func (h * BufPane ) ToggleOverwriteMode () bool {
1867- h .isOverwriteMode = ! h .isOverwriteMode
1867+ h .Buf . OverwriteMode = ! h .Buf . OverwriteMode
18681868 return true
18691869}
18701870
Original file line number Diff line number Diff line change @@ -224,8 +224,6 @@ type BufPane struct {
224224 // (possibly multiple) buttons were pressed previously.
225225 mousePressed map [MouseEvent ]bool
226226
227- // We need to keep track of insert key press toggle
228- isOverwriteMode bool
229227 // This stores when the last click was
230228 // This is useful for detecting double and triple clicks
231229 lastClickTime time.Time
@@ -358,9 +356,6 @@ func (h *BufPane) OpenBuffer(b *buffer.Buffer) {
358356 // Set mouseReleased to true because we assume the mouse is not being
359357 // pressed when the editor is opened
360358 h .resetMouse ()
361- // Set isOverwriteMode to false, because we assume we are in the default
362- // mode when editor is opened
363- h .isOverwriteMode = false
364359 h .lastClickTime = time.Time {}
365360}
366361
@@ -639,7 +634,7 @@ func (h *BufPane) DoRuneInsert(r rune) {
639634 c .ResetSelection ()
640635 }
641636
642- if h .isOverwriteMode {
637+ if h .Buf . OverwriteMode {
643638 next := c .Loc
644639 next .X ++
645640 h .Buf .Replace (c .Loc , next , string (r ))
Original file line number Diff line number Diff line change @@ -209,6 +209,11 @@ type Buffer struct {
209209 LastSearchRegex bool
210210 // HighlightSearch enables highlighting all instances of the last successful search
211211 HighlightSearch bool
212+
213+ // OverwriteMode indicates that we are in overwrite mode (toggled by
214+ // Insert key by default) i.e. that typing a character shall replace the
215+ // character under the cursor instead of inserting a character before it.
216+ OverwriteMode bool
212217}
213218
214219// NewBufferFromFileAtLoc opens a new buffer with a given cursor location
You can’t perform that action at this time.
0 commit comments