Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
e652658f
Commit
e652658f
authored
7 years ago
by
nightfox
Browse files
Options
Downloads
Patches
Plain Diff
Fixed a bug in calculating the displayable item text lengths.
parent
9347a333
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/load/DDLightbarMenu.js
+9
-5
9 additions, 5 deletions
exec/load/DDLightbarMenu.js
with
9 additions
and
5 deletions
exec/load/DDLightbarMenu.js
+
9
−
5
View file @
e652658f
...
...
@@ -498,7 +498,7 @@ function DDLightbarMenu_WriteItem(pIdx, pItemLen, pHighlight)
// Get the item text, and truncate it to the displayable item width
var
itemText
=
this
.
items
[
pIdx
].
text
;
if
(
itemTextDisplayableLen
(
itemText
)
>
itemLen
)
if
(
itemTextDisplayableLen
(
itemText
,
this
.
ampersandHotkeysInItems
)
>
itemLen
)
itemText
=
itemText
.
substr
(
0
,
itemLen
);
// Add the item color to the text
itemText
=
itemColor
+
itemText
;
...
...
@@ -526,7 +526,7 @@ function DDLightbarMenu_WriteItem(pIdx, pItemLen, pHighlight)
// Ensure the item text fills the width of the menu (in case there's a
// background color, it should be used for the entire width of the item
// text). Then write the item.
var
currentTextLen
=
itemTextDisplayableLen
(
itemText
);
var
currentTextLen
=
itemTextDisplayableLen
(
itemText
,
this
.
ampersandHotkeysInItems
);
if
(
currentTextLen
<
itemLen
)
itemText
+=
format
(
"
%
"
+
+
(
itemLen
-
currentTextLen
)
+
"
s
"
,
""
);
// Append spaces to the end of itemText
console
.
print
(
itemText
+
"
\
1n
"
);
...
...
@@ -961,12 +961,16 @@ function getKeyWithESCChars(pGetKeyMode)
// Returns the length of an item's text, not counting non-displayable
// characters (such as Synchronet color attributes and an ampersand
// immediately before a non-space)
function
itemTextDisplayableLen
(
pText
)
//
// Parameters:
// pText: The text to test
// pAmpersandHotkeysInItems: Boolean - Whether or not ampersand hotkeys are enabled for the item text
function
itemTextDisplayableLen
(
pText
,
pAmpersandHotkeysInItems
)
{
var
textLen
=
strip_ctrl
(
pText
).
length
;
// If
a
mpersandHotkeysInItems is true, look for ampersands immediately
// If
pA
mpersandHotkeysInItems is true, look for ampersands immediately
// before a non-space and if found, don't count those.
if
(
this
.
a
mpersandHotkeysInItems
)
if
(
pA
mpersandHotkeysInItems
)
{
var
startIdx
=
0
;
var
ampersandIndex
=
pText
.
indexOf
(
"
&
"
,
startIdx
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment