Skip to content

Commit

Permalink
Enhance the length check of Contents
Browse files Browse the repository at this point in the history
Fix Panic with irregular character bsContent.
  • Loading branch information
noborus committed Dec 24, 2024
1 parent 8368efc commit 276a5b9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions oviewer/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@ func (st *parseState) backspaceHandle() {
st.bsFlag = true
st.bsContent = st.lc.last()

if st.bsContent.width == 1 {
st.lc = st.lc[:len(st.lc)-1]
if st.bsContent.width == 2 && len(st.lc) > 1 {
st.lc = st.lc[:len(st.lc)-2]
return
}
st.lc = st.lc[:len(st.lc)-2]
st.lc = st.lc[:len(st.lc)-1]
}

// controlCharHandle handles control characters.
Expand Down

0 comments on commit 276a5b9

Please sign in to comment.