aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Frontend
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-08-02 08:27:33 -0400
committerMichael <[email protected]>2017-08-02 08:27:33 -0400
commitc832b7830853c33bed586e89ddae261200bb526e (patch)
tree01df01e57958baa954c2df4b8666c4c4c5f4eac5 /ShiftOS.Frontend
parentd5a47f546f51010d81ed46d2222f1b8f4509ed3e (diff)
downloadshiftos_thereturn-c832b7830853c33bed586e89ddae261200bb526e.tar.gz
shiftos_thereturn-c832b7830853c33bed586e89ddae261200bb526e.tar.bz2
shiftos_thereturn-c832b7830853c33bed586e89ddae261200bb526e.zip
slightly fix caret movement and wrapping
Diffstat (limited to 'ShiftOS.Frontend')
-rw-r--r--ShiftOS.Frontend/Apps/Terminal.cs14
1 files changed, 10 insertions, 4 deletions
diff --git a/ShiftOS.Frontend/Apps/Terminal.cs b/ShiftOS.Frontend/Apps/Terminal.cs
index 9fe71de..5bedcf0 100644
--- a/ShiftOS.Frontend/Apps/Terminal.cs
+++ b/ShiftOS.Frontend/Apps/Terminal.cs
@@ -183,11 +183,17 @@ namespace ShiftOS.Frontend.Apps
var font = new Font(LoadedSkin.TerminalFont.Name, LoadedSkin.TerminalFont.Size * _zoomFactor, LoadedSkin.TerminalFont.Style);
int currline = GetCurrentLine();
string substring = String.Join(Environment.NewLine, Lines.Take(currline + 1));
- int h = (int)Math.Round(gfx.SmartMeasureString(substring, font).Height - font.Height);
- var lineMeasure = gfx.SmartMeasureString(Lines[currline], font);
+ int h = (int)Math.Round(gfx.SmartMeasureString(substring, font, Width).Height - font.Height);
+
+ int linestart = String.Join(Environment.NewLine, Lines.Take(GetCurrentLine())).Length;
+
+ var lineMeasure = gfx.SmartMeasureString(Text.Substring(linestart, Index - linestart), font);
int w = (int)Math.Floor(lineMeasure.Width);
- if (w > Width - 4)
- w = Width - 4;
+ while (w > Width)
+ {
+ w -= Width;
+ h += (int)lineMeasure.Height;
+ }
return new System.Drawing.Point(w, h);
}