mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-13 19:50:31 +00:00
Only delete indent when at the beginning of a line
edit currently deletes the previous 4 spaces when pressing backspace, wherever you are on the line. This can be frustrating when you are trying to align text in comments or strings. This changes edit to only delete 4 spaces if all preceding characters are whitespace, otherwise it only deletes a single character.
This commit is contained in:
parent
87406bc00d
commit
1ab5094b7f
@ -642,7 +642,7 @@ while bRunning do
|
||||
if x > 1 then
|
||||
-- Remove character
|
||||
local sLine = tLines[y]
|
||||
if x > 4 and string.sub(sLine,x-4,x-1) == " " then
|
||||
if x > 4 and string.sub(sLine,x-4,x-1) == " " and not string.sub(sLine, 1, x - 1):find("%S") then
|
||||
tLines[y] = string.sub(sLine,1,x-5) .. string.sub(sLine,x)
|
||||
setCursor( x - 4, y )
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user