Fixes #1796. If TextView is ReadOnly tab and return are ignored. Also fixes Button click via spacebar (#1804)

* Fixes #1796. If TextView is read only allows tab around and return.

* Fixes space bar responding on Button.
This commit is contained in:
BDisp
2022-06-13 23:48:23 +01:00
committed by GitHub
parent 3001d43006
commit 2e2566f0f0
2 changed files with 6 additions and 8 deletions

View File

@@ -159,7 +159,7 @@ namespace Terminal.Gui {
set {
if (hotKey != value) {
var v = value == Key.Unknown ? Key.Null : value;
if (ContainsKeyBinding (Key.Space | hotKey)) {
if (hotKey != Key.Null && ContainsKeyBinding (Key.Space | hotKey)) {
if (v == Key.Null) {
ClearKeybinding (Key.Space | hotKey);
} else {

View File

@@ -2934,8 +2934,8 @@ namespace Terminal.Gui {
{
ResetColumnTrack ();
if (!AllowsTab) {
return false;
if (!AllowsTab || isReadOnly) {
return ProcessMovePreviousView ();
}
if (currentColumn > 0) {
var currentLine = GetCurrentLine ();
@@ -2958,8 +2958,8 @@ namespace Terminal.Gui {
{
ResetColumnTrack ();
if (!AllowsTab) {
return false;
if (!AllowsTab || isReadOnly) {
return ProcessMoveNextView ();
}
InsertText (new KeyEvent ((Key)'\t', null));
DoNeededAction ();
@@ -2977,11 +2977,9 @@ namespace Terminal.Gui {
{
ResetColumnTrack ();
if (!AllowsReturn) {
if (!AllowsReturn || isReadOnly) {
return false;
}
if (isReadOnly)
return true;
var currentLine = GetCurrentLine ();