equal
deleted
inserted
replaced
763 if (num < w->hscroll.pos) w->hscroll.pos = num; |
763 if (num < w->hscroll.pos) w->hscroll.pos = num; |
764 } |
764 } |
765 |
765 |
766 static void DelChar(Textbuf *tb) |
766 static void DelChar(Textbuf *tb) |
767 { |
767 { |
768 tb->width -= GetCharacterWidth(tb->buf[tb->caretpos]); |
768 tb->width -= GetCharacterWidth((byte)tb->buf[tb->caretpos]); |
769 memmove(tb->buf + tb->caretpos, tb->buf + tb->caretpos + 1, tb->length - tb->caretpos); |
769 memmove(tb->buf + tb->caretpos, tb->buf + tb->caretpos + 1, tb->length - tb->caretpos); |
770 tb->length--; |
770 tb->length--; |
771 } |
771 } |
772 |
772 |
773 /** |
773 /** |
779 */ |
779 */ |
780 bool DeleteTextBufferChar(Textbuf *tb, int delmode) |
780 bool DeleteTextBufferChar(Textbuf *tb, int delmode) |
781 { |
781 { |
782 if (delmode == WKC_BACKSPACE && tb->caretpos != 0) { |
782 if (delmode == WKC_BACKSPACE && tb->caretpos != 0) { |
783 tb->caretpos--; |
783 tb->caretpos--; |
784 tb->caretxoffs -= GetCharacterWidth(tb->buf[tb->caretpos]); |
784 tb->caretxoffs -= GetCharacterWidth((byte)tb->buf[tb->caretpos]); |
785 |
785 |
786 DelChar(tb); |
786 DelChar(tb); |
787 return true; |
787 return true; |
788 } else if (delmode == WKC_DELETE && tb->caretpos < tb->length) { |
788 } else if (delmode == WKC_DELETE && tb->caretpos < tb->length) { |
789 DelChar(tb); |
789 DelChar(tb); |
827 { |
827 { |
828 switch (navmode) { |
828 switch (navmode) { |
829 case WKC_LEFT: |
829 case WKC_LEFT: |
830 if (tb->caretpos != 0) { |
830 if (tb->caretpos != 0) { |
831 tb->caretpos--; |
831 tb->caretpos--; |
832 tb->caretxoffs -= GetCharacterWidth(tb->buf[tb->caretpos]); |
832 tb->caretxoffs -= GetCharacterWidth((byte)tb->buf[tb->caretpos]); |
833 return true; |
833 return true; |
834 } |
834 } |
835 break; |
835 break; |
836 case WKC_RIGHT: |
836 case WKC_RIGHT: |
837 if (tb->caretpos < tb->length) { |
837 if (tb->caretpos < tb->length) { |
838 tb->caretxoffs += GetCharacterWidth(tb->buf[tb->caretpos]); |
838 tb->caretxoffs += GetCharacterWidth((byte)tb->buf[tb->caretpos]); |
839 tb->caretpos++; |
839 tb->caretpos++; |
840 return true; |
840 return true; |
841 } |
841 } |
842 break; |
842 break; |
843 case WKC_HOME: |
843 case WKC_HOME: |