aboutsummaryrefslogtreecommitdiffhomepage
path: root/core
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2021-05-29 13:42:55 -0400
committerGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2021-05-29 13:42:55 -0400
commit0153f16c581b0c9ebb4b65913fddac5690dfa81e (patch)
tree8e74a4aa70a2cb4890966143632494a1ce38da11 /core
parent9c3e0e901d646b8c6093277f2c6959fb4d3e6b5f (diff)
Do not attempt to restore the selection when typing after selecting/deleting all text.
Otherwise each typed character overwrites the previously typed character.
Diffstat (limited to 'core')
-rw-r--r--core/ui.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/ui.lua b/core/ui.lua
index c8266775..21fcbf80 100644
--- a/core/ui.lua
+++ b/core/ui.lua
@@ -375,7 +375,8 @@ local function restore_buffer_state()
view.x_offset = buffer._x_offset or 0
end
events.connect(events.BUFFER_AFTER_SWITCH, restore_buffer_state)
-events.connect(events.BUFFER_AFTER_REPLACE_TEXT, restore_buffer_state)
+events.connect(events.BUFFER_AFTER_REPLACE_TEXT,
+ function() if buffer.length > 1 then restore_buffer_state() end end)
-- Updates titlebar and statusbar.
local function update_bars()