Various QoL fixes in UI

* Update AP menus, add options
* AP menu prompt to show user's Actor/Subject name
* Allow MLTEV to have focus SGRs
This commit is contained in:
Bryan Ashby 2023-02-25 13:07:13 -07:00
parent 0263d8bc5e
commit 0af70b0f57
No known key found for this signature in database
GPG Key ID: C2C1B501E4EFD994
11 changed files with 61 additions and 22 deletions

View File

@ -1474,6 +1474,14 @@
} }
} }
} }
activityPubMenuCommand: {
mci: {
TL1: {
text: "|00|08(|11|AS|08)"
}
}
}
} }
achievements: { achievements: {

View File

@ -254,6 +254,8 @@ exports.getModule = class ActivityPubUserConfig extends MenuModule {
imageView.setText(apSettings.image); imageView.setText(apSettings.image);
iconView.setText(apSettings.icon); iconView.setText(apSettings.icon);
imageView.setFocus(true);
return callback(null); return callback(null);
}, },
], ],

View File

@ -505,7 +505,7 @@ exports.FullScreenEditorModule =
msg = insert( msg = insert(
msg, msg,
tearLinePos, tearLinePos,
bodyMessageView.getSGRFor('text') bodyMessageView.getTextSgrPrefix()
); );
} }
@ -1496,7 +1496,7 @@ exports.FullScreenEditorModule =
const bodyMessageView = this.viewControllers.body.getView( const bodyMessageView = this.viewControllers.body.getView(
MciViewIds.body.message MciViewIds.body.message
); );
quoteLines += `${ansi.normal()}${bodyMessageView.getSGRFor('text')}`; quoteLines += `${ansi.normal()}${bodyMessageView.getTextSgrPrefix()}`;
} }
msgView.addText(`${quoteLines}\n\n`); msgView.addText(`${quoteLines}\n\n`);
} }

View File

@ -128,14 +128,6 @@ function MultiLineEditTextView(options) {
// //
this.cursorPos = { col: 0, row: 0 }; this.cursorPos = { col: 0, row: 0 };
this.getSGRFor = function (sgrFor) {
return (
{
text: self.getSGR(),
}[sgrFor] || self.getSGR()
);
};
this.isEditMode = function () { this.isEditMode = function () {
return 'edit' === self.mode; return 'edit' === self.mode;
}; };
@ -144,6 +136,14 @@ function MultiLineEditTextView(options) {
return 'preview' === self.mode; return 'preview' === self.mode;
}; };
this.getTextSgrPrefix = function () {
if (!self.isEditMode()) {
return '';
}
return self.hasFocus ? self.getFocusSGR() : self.getSGR();
};
// :TODO: Most of the calls to this could be avoided via incrementRow(), decrementRow() that keeps track or such // :TODO: Most of the calls to this could be avoided via incrementRow(), decrementRow() that keeps track or such
this.getTextLinesIndex = function (row) { this.getTextLinesIndex = function (row) {
if (!_.isNumber(row)) { if (!_.isNumber(row)) {
@ -171,7 +171,7 @@ function MultiLineEditTextView(options) {
this.toggleTextCursor = function (action) { this.toggleTextCursor = function (action) {
self.client.term.rawWrite( self.client.term.rawWrite(
`${self.getSGRFor('text')}${ `${self.getTextSgrPrefix()}${
'hide' === action ? ansi.hideCursor() : ansi.showCursor() 'hide' === action ? ansi.hideCursor() : ansi.showCursor()
}` }`
); );
@ -183,11 +183,11 @@ function MultiLineEditTextView(options) {
const startIndex = self.getTextLinesIndex(startRow); const startIndex = self.getTextLinesIndex(startRow);
const endIndex = Math.min(self.getTextLinesIndex(endRow), self.textLines.length); const endIndex = Math.min(self.getTextLinesIndex(endRow), self.textLines.length);
const absPos = self.getAbsolutePosition(startRow, 0); const absPos = self.getAbsolutePosition(startRow, 0);
const prefix = self.getTextSgrPrefix();
for (let i = startIndex; i < endIndex; ++i) { for (let i = startIndex; i < endIndex; ++i) {
//${self.getSGRFor('text')}
self.client.term.write( self.client.term.write(
`${ansi.goto(absPos.row++, absPos.col)}${self.getRenderText(i)}`, `${ansi.goto(absPos.row++, absPos.col)}${prefix}${self.getRenderText(i)}`,
false // convertLineFeeds false // convertLineFeeds
); );
} }
@ -492,7 +492,7 @@ function MultiLineEditTextView(options) {
.slice(self.cursorPos.col - c.length); .slice(self.cursorPos.col - c.length);
self.client.term.write( self.client.term.write(
`${ansi.hideCursor()}${self.getSGRFor('text')}${renderText}${ansi.goto( `${ansi.hideCursor()}${self.getTextSgrPrefix()}${renderText}${ansi.goto(
absPos.row, absPos.row,
absPos.col absPos.col
)}${ansi.showCursor()}`, )}${ansi.showCursor()}`,
@ -1105,10 +1105,14 @@ MultiLineEditTextView.prototype.redraw = function () {
}; };
MultiLineEditTextView.prototype.setFocus = function (focused) { MultiLineEditTextView.prototype.setFocus = function (focused) {
this.client.term.rawWrite(this.getSGRFor('text'));
this.moveClientCursorToCursorPos();
MultiLineEditTextView.super_.prototype.setFocus.call(this, focused); MultiLineEditTextView.super_.prototype.setFocus.call(this, focused);
if (this.isEditMode() && this.getSGR() !== this.getFocusSGR()) {
this.redrawVisibleArea();
} else {
this.client.term.rawWrite(this.getTextSgrPrefix());
}
this.moveClientCursorToCursorPos();
}; };
MultiLineEditTextView.prototype.setText = function ( MultiLineEditTextView.prototype.setText = function (

View File

@ -1,9 +1,9 @@
{ {
menus: { menus: {
activityPubMenu: { activityPubMenu: {
desc: ActivityPub desc: ActivityPub Menu
art: activitypub_menu art: activitypub_menu
prompt: menuCommand prompt: activiytPubMenuCommand
submit: [ submit: [
{ {
value: {command: "S"} value: {command: "S"}
@ -14,17 +14,26 @@
action: @menu:activityPubUserConfig action: @menu:activityPubUserConfig
} }
{ {
value: {command: "M"} value: {command: "S"}
action: @menu:activityPubSocialManager action: @menu:activityPubSocialManager
} }
{ {
value: {command: "Q"} value: {command: "Q"}
action: @menu:mainMenu action: @menu:mainMenu
} }
{
value: { command: "E" }
action: @menu:privateMailMenu
}
{
value: { command: "G" }
action: @menu:fullLogoffSequence
}
] ]
} }
activityPubActorSearch: { activityPubActorSearch: {
desc: Viewing ActivityPub desc: ActivityPub Search
module: activitypub/actor_search module: activitypub/actor_search
config: { config: {
cls: true cls: true
@ -166,7 +175,7 @@
} }
} }
activityPubSocialManager: { activityPubSocialManager: {
desc: Social Manager desc: ActivityPub Social Manager
module: ./activitypub/social_manager module: ./activitypub/social_manager
config: { config: {
art: {main: "activitypub_social_manager"} art: {main: "activitypub_social_manager"}
@ -199,4 +208,20 @@
} }
} }
} }
prompts: {
activityPubMenuCommand: {
art: activitypub_menu_prompt
mci: {
ET2: {
argName: command
width: 20
maxLength: 20
submit: true
textStyle: upper
focus: true
}
}
}
}
} }