This commit is contained in:
Adam D. Ruppe 2014-12-09 19:18:38 -05:00
parent 19bf07d7fd
commit d9e6fbeedc
1 changed files with 8 additions and 8 deletions

View File

@ -2380,7 +2380,7 @@ class LineGetter {
if(howFarBack < 0) if(howFarBack < 0)
howFarBack = 0; howFarBack = 0;
if(howFarBack > history.length) // lol signed/unsigned comparison here means if i did this first, before howFarBack < 0, it would totally cycle around. if(howFarBack > history.length) // lol signed/unsigned comparison here means if i did this first, before howFarBack < 0, it would totally cycle around.
howFarBack = history.length; howFarBack = cast(int) history.length;
if(howFarBack == currentHistoryViewPosition) if(howFarBack == currentHistoryViewPosition)
return; return;
if(currentHistoryViewPosition == 0) { if(currentHistoryViewPosition == 0) {
@ -2407,7 +2407,7 @@ class LineGetter {
line ~= ch; line ~= ch;
} }
cursorPosition = line.length; cursorPosition = cast(int) line.length;
} }
bool insertMode = true; bool insertMode = true;
@ -2451,7 +2451,7 @@ class LineGetter {
assert(line.length); assert(line.length);
if(insertMode) { if(insertMode) {
line ~= ' '; line ~= ' ';
for(int i = line.length - 2; i >= cursorPosition; i --) for(int i = cast(int) line.length - 2; i >= cursorPosition; i --)
line[i + 1] = line[i]; line[i + 1] = line[i];
} }
line[cursorPosition] = ch; line[cursorPosition] = ch;
@ -2494,10 +2494,10 @@ class LineGetter {
if(line.length < lastDrawLength) if(line.length < lastDrawLength)
foreach(i; line.length + suggestion.length + prompt.length .. lastDrawLength) foreach(i; line.length + suggestion.length + prompt.length .. lastDrawLength)
terminal.write(" "); terminal.write(" ");
lastDrawLength = line.length + suggestion.length + prompt.length; // FIXME: graphemes and utf-8 on suggestion/prompt lastDrawLength = cast(int) (line.length + suggestion.length + prompt.length); // FIXME: graphemes and utf-8 on suggestion/prompt
// FIXME: wrapping // FIXME: wrapping
terminal.moveTo(startOfLineX + cursorPosition + prompt.length, startOfLineY); terminal.moveTo(startOfLineX + cursorPosition + cast(int) prompt.length, startOfLineY);
} }
/// Starts getting a new line. Call workOnLine and finishGettingLine afterward. /// Starts getting a new line. Call workOnLine and finishGettingLine afterward.
@ -2656,7 +2656,7 @@ class LineGetter {
redraw(); redraw();
break; break;
case NonCharacterKeyEvent.Key.PageUp: case NonCharacterKeyEvent.Key.PageUp:
loadFromHistory(history.length); loadFromHistory(cast(int) history.length);
redraw(); redraw();
break; break;
case NonCharacterKeyEvent.Key.PageDown: case NonCharacterKeyEvent.Key.PageDown:
@ -2668,7 +2668,7 @@ class LineGetter {
redraw(); redraw();
break; break;
case NonCharacterKeyEvent.Key.End: case NonCharacterKeyEvent.Key.End:
cursorPosition = line.length; cursorPosition = cast(int) line.length;
redraw(); redraw();
break; break;
case NonCharacterKeyEvent.Key.Insert: case NonCharacterKeyEvent.Key.Insert:
@ -2698,7 +2698,7 @@ class LineGetter {
if(me.buttons & MouseEvent.Button.Left) { if(me.buttons & MouseEvent.Button.Left) {
if(me.y == startOfLineY) { if(me.y == startOfLineY) {
// FIXME: prompt.length should be graphemes or at least code poitns // FIXME: prompt.length should be graphemes or at least code poitns
int p = me.x - startOfLineX - prompt.length; int p = me.x - startOfLineX - cast(int) prompt.length;
if(p >= 0 && p < line.length) { if(p >= 0 && p < line.length) {
justHitTab = false; justHitTab = false;
cursorPosition = p; cursorPosition = p;