Skip to content

Commit

Permalink
Replace comparisons < 0 with <> 0 when variable must be >= 0.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsc committed Jul 7, 2020
1 parent 93c14a8 commit 819c1a7
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/editor.bas
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ PROC SaveLine
MemEnd = MemEnd + newPtr
if newPtr < 0
move ptr, nptr, MemEnd - nptr
elif newPtr > 0
elif newPtr <> 0
-move ptr, nptr, MemEnd - nptr
endif

Expand All @@ -241,16 +241,13 @@ PROC CopyToEdit
' Get column in range
if column > linLen
column = linLen
if linLen < 0
column = 0
endif
endif

' Copy line to 'Edit' buffer, if not too long
if linLen > 255
linLen = 255
endif
if linLen > 0
if linLen <> 0
move ptr, EditBuf, linLen
else
poke EditBuf, $9b
Expand Down Expand Up @@ -420,7 +417,7 @@ PROC DrawLinePtr
bput #0, ptr, max
poke @@OLDCHR, $DF
else
if lLen > 0
if lLen <> 0
bput #0, ptr, lLen
endif
max = max - lLen
Expand Down Expand Up @@ -711,7 +708,7 @@ ENDPROC
' Deletes char to the left of current
'
PROC DoBackspace
if column > 0
if column <> 0
column = column - 1
exec DoDeleteKey
endif
Expand Down Expand Up @@ -869,7 +866,7 @@ PROC ProcessKeys
'
'--------- Right ----------------
elif key = $1E
if column > 0
if column <> 0
dec column
if scrColumn > 1
dec scrColumn
Expand Down

0 comments on commit 819c1a7

Please sign in to comment.