Fixed selection bug in post window.

This commit is contained in:
Snowyfox 2022-05-21 23:43:06 -04:00
parent 150773de8b
commit b4bfebc80a

View File

@ -369,6 +369,7 @@ implements
selStart = identifyNodeAt(eM.getX(), eM.getY());
selEnd = null;
repaint();
requestFocusInWindow();
}
public void
@ -450,16 +451,18 @@ implements
keyPressed(KeyEvent eK)
{
if (!eK.isControlDown()) return;
switch (eK.getKeyCode())
{
case KeyEvent.VK_C:
if (selEnd == null) return;
ClipboardApi.serve(getSelectedText());
break;
return;
case KeyEvent.VK_A:
selStart = identifyNodeAt(0, 0);
selEnd = layoutEnd;
repaint();
break;
return;
}
}
@ -485,9 +488,9 @@ implements
Position position = layout.get(node);
assert position != null;
boolean after = position.compareTo(ssp) > 0;
boolean after = position.compareTo(ssp) >= 0;
boolean before = position.compareTo(sep) < 0;
if (!(after || before)) continue;
if (!(after && before)) continue;
// Just throw them in a pile for now..
selected.add(node);
@ -619,6 +622,12 @@ implements
return 0;
}
public String
toString()
{
return "(" + x + "," + line + ")";
}
// -=%=-
public
@ -655,6 +664,8 @@ implements
this.addMouseMotionListener(this);
this.addKeyListener(this);
setFocusable(true);
// A keyboard user can still copy by tabbing in
// and selecting all.
}
}