aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2015-07-14 00:54:15 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2015-07-14 00:54:15 +0200
commitc77101ce15d3d09ed7f257eea9c8bfa456a725c4 (patch)
tree981c474891077e8d18d69f17e205bef9cb60c585
parent6a9a7d56643c496ec9da643e19c254c5a3b397ed (diff)
downloadsciteco-c77101ce15d3d09ed7f257eea9c8bfa456a725c4.tar.gz
curses: fixed arithmetic error when window is smaller than 2 columns
-rw-r--r--src/interface-curses.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/interface-curses.cpp b/src/interface-curses.cpp
index 7f5693c..47f26b8 100644
--- a/src/interface-curses.cpp
+++ b/src/interface-curses.cpp
@@ -867,7 +867,8 @@ InterfaceCurses::draw_cmdline(void)
guint disp_len;
disp_offset = cmdline_len -
- MIN(cmdline_len, total_width/2 + cmdline_len % (total_width/2));
+ MIN(cmdline_len,
+ total_width/2 + cmdline_len % MAX(total_width/2, 1));
/*
* NOTE: we do not use getmaxx(cmdline_pad) here since it may be
* larger than the text the pad contains.