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: {

View File

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

View File

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

View File

@ -128,14 +128,6 @@ function MultiLineEditTextView(options) {
//
this.cursorPos = { col: 0, row: 0 };
this.getSGRFor = function (sgrFor) {
return (
{
text: self.getSGR(),
}[sgrFor] || self.getSGR()
);
};
this.isEditMode = function () {
return 'edit' === self.mode;
};
@ -144,6 +136,14 @@ function MultiLineEditTextView(options) {
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
this.getTextLinesIndex = function (row) {
if (!_.isNumber(row)) {
@ -171,7 +171,7 @@ function MultiLineEditTextView(options) {
this.toggleTextCursor = function (action) {
self.client.term.rawWrite(
`${self.getSGRFor('text')}${
`${self.getTextSgrPrefix()}${
'hide' === action ? ansi.hideCursor() : ansi.showCursor()
}`
);
@ -183,11 +183,11 @@ function MultiLineEditTextView(options) {
const startIndex = self.getTextLinesIndex(startRow);
const endIndex = Math.min(self.getTextLinesIndex(endRow), self.textLines.length);
const absPos = self.getAbsolutePosition(startRow, 0);
const prefix = self.getTextSgrPrefix();
for (let i = startIndex; i < endIndex; ++i) {
//${self.getSGRFor('text')}
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
);
}
@ -492,7 +492,7 @@ function MultiLineEditTextView(options) {
.slice(self.cursorPos.col - c.length);
self.client.term.write(
`${ansi.hideCursor()}${self.getSGRFor('text')}${renderText}${ansi.goto(
`${ansi.hideCursor()}${self.getTextSgrPrefix()}${renderText}${ansi.goto(
absPos.row,
absPos.col
)}${ansi.showCursor()}`,
@ -1105,10 +1105,14 @@ MultiLineEditTextView.prototype.redraw = function () {
};
MultiLineEditTextView.prototype.setFocus = function (focused) {
this.client.term.rawWrite(this.getSGRFor('text'));
this.moveClientCursorToCursorPos();
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 (

View File

@ -1,9 +1,9 @@
{
menus: {
activityPubMenu: {
desc: ActivityPub
desc: ActivityPub Menu
art: activitypub_menu
prompt: menuCommand
prompt: activiytPubMenuCommand
submit: [
{
value: {command: "S"}
@ -14,17 +14,26 @@
action: @menu:activityPubUserConfig
}
{
value: {command: "M"}
value: {command: "S"}
action: @menu:activityPubSocialManager
}
{
value: {command: "Q"}
action: @menu:mainMenu
}
{
value: { command: "E" }
action: @menu:privateMailMenu
}
{
value: { command: "G" }
action: @menu:fullLogoffSequence
}
]
}
activityPubActorSearch: {
desc: Viewing ActivityPub
desc: ActivityPub Search
module: activitypub/actor_search
config: {
cls: true
@ -166,7 +175,7 @@
}
}
activityPubSocialManager: {
desc: Social Manager
desc: ActivityPub Social Manager
module: ./activitypub/social_manager
config: {
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
}
}
}
}
}