Skip to content

Commit

Permalink
Rename to trimTrailingWhitespacePlusSpace
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuuuube committed Nov 27, 2024
1 parent 508889c commit a68f897
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ext/js/data/string-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function readCodePointsBackward(text, position, count) {
* @param {string} text
* @returns {string}
*/
export function trimTrailingWhitespaceMinusSpace(text) {
export function trimTrailingWhitespacePlusSpace(text) {
const prevTextLength = text.length;
const textTrimmed = text.trimEnd();
return prevTextLength === textTrimmed.length ? textTrimmed : textTrimmed + ' ';
Expand Down
4 changes: 2 additions & 2 deletions ext/js/display/query-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import {EventDispatcher} from '../core/event-dispatcher.js';
import {log} from '../core/log.js';
import {trimTrailingWhitespaceMinusSpace} from '../data/string-util.js';
import {trimTrailingWhitespacePlusSpace} from '../data/string-util.js';
import {querySelectorNotNull} from '../dom/query-selector.js';
import {convertHiraganaToKatakana, convertKatakanaToHiragana, isStringEntirelyKana} from '../language/ja/japanese.js';
import {TextScanner} from '../language/text-scanner.js';
Expand Down Expand Up @@ -305,7 +305,7 @@ export class QueryParser extends EventDispatcher {
termNode.className = 'query-parser-term';
termNode.dataset.offset = `${offset}`;
for (const {text, reading} of term) {
const trimmedText = trimTrailingWhitespaceMinusSpace(text);
const trimmedText = trimTrailingWhitespacePlusSpace(text);
if (reading.length === 0) {
termNode.appendChild(document.createTextNode(trimmedText));
} else {
Expand Down
4 changes: 2 additions & 2 deletions ext/js/display/search-display-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import * as wanakana from '../../lib/wanakana.js';
import {ClipboardMonitor} from '../comm/clipboard-monitor.js';
import {createApiMap, invokeApiMapHandler} from '../core/api-map.js';
import {EventListenerCollection} from '../core/event-listener-collection.js';
import {trimTrailingWhitespaceMinusSpace} from '../data/string-util.js';
import {trimTrailingWhitespacePlusSpace} from '../data/string-util.js';
import {querySelectorNotNull} from '../dom/query-selector.js';

export class SearchDisplayController {
Expand Down Expand Up @@ -238,7 +238,7 @@ export class SearchDisplayController {
this._searchBackButton.hidden = !showBackButton;

if (this._queryInput.value !== query) {
this._queryInput.value = trimTrailingWhitespaceMinusSpace(query);
this._queryInput.value = trimTrailingWhitespacePlusSpace(query);
this._updateSearchHeight(true);
}
this._setIntroVisible(!valid, animate);
Expand Down

0 comments on commit a68f897

Please sign in to comment.