diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2014-09-09 16:28:57 -0700 |
---|---|---|
committer | Michael Vrhel <michael.vrhel@artifex.com> | 2014-09-09 16:39:40 -0700 |
commit | 8a9519f2183b64fe220bcb1f6acedbe6acc190cd (patch) | |
tree | 1009b596bdb998a8f8447d09f5edaa12eca8dbb6 /platform/winrt/gsview/MainWindow.xaml.cs | |
parent | aa39972b466b169c6bec1c5448d8407711cc0475 (diff) | |
download | mupdf-8a9519f2183b64fe220bcb1f6acedbe6acc190cd.tar.xz |
Fix bug in text selection.
The code was doing the proper highlighting but failing to add all but the
first character in the first selected line.
Diffstat (limited to 'platform/winrt/gsview/MainWindow.xaml.cs')
-rw-r--r-- | platform/winrt/gsview/MainWindow.xaml.cs | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/platform/winrt/gsview/MainWindow.xaml.cs b/platform/winrt/gsview/MainWindow.xaml.cs index b4a1fb6d..6e6ee855 100644 --- a/platform/winrt/gsview/MainWindow.xaml.cs +++ b/platform/winrt/gsview/MainWindow.xaml.cs @@ -3771,20 +3771,30 @@ namespace gsview start_line.Height = 0; start_line.Scale = m_doczoom; /* Use either anchor point or mouse pos */ + bool highlight_done = false; for (int mm = 0; mm < lett.Count; mm++) { double letscale = m_doczoom / lett[mm].Scale; if (lett[mm].X * letscale + lett[mm].Width * letscale >= val) { - start_line.Color = m_textselectcolor; - /* special color for debug */ - //start_line.Color = "#40FF0000"; - start_line.Height = lines[kk].Height * scale; - start_line.Width = lines[kk].X * scale + lines[kk].Width * scale - lett[mm].X * letscale; - start_line.X = lett[mm].X * letscale; - start_line.Y = lines[kk].Y * scale; + /* In this case, we are done with the + * highlight section as it only + * depends upon the first character + * we encounter and the line end. + * But we must continue to add in + * the selected characters */ + if (!highlight_done) + { + start_line.Color = m_textselectcolor; + /* special color for debug */ + /* start_line.Color = "#40FF0000"; */ + start_line.Height = lines[kk].Height * scale; + start_line.Width = lines[kk].X * scale + lines[kk].Width * scale - lett[mm].X * letscale; + start_line.X = lett[mm].X * letscale; + start_line.Y = lines[kk].Y * scale; + highlight_done = true; + } start_line.TextCharacters.Add(lett[mm]); - break; } } if (start_line.Height > 0) |