슬래시 하이라이트 인덱스 보정 분리
This commit is contained in:
@@ -274,6 +274,23 @@ export const removeSlashSuppressedLine = (suppressedLines, line) => {
|
||||
return next
|
||||
}
|
||||
|
||||
/**
|
||||
* 슬래시 메뉴 하이라이트 인덱스를 명령 목록 범위 안으로 보정한다.
|
||||
* @param {number} currentIndex - 현재 하이라이트 인덱스
|
||||
* @param {number} commandCount - 표시 가능한 명령 개수
|
||||
* @returns {number} 보정된 인덱스
|
||||
*/
|
||||
export const clampSlashHighlightedIndex = (currentIndex, commandCount) => {
|
||||
const count = Math.max(0, Number.isFinite(commandCount) ? Math.floor(commandCount) : 0)
|
||||
const index = Math.max(0, Number.isFinite(currentIndex) ? Math.floor(currentIndex) : 0)
|
||||
|
||||
if (count <= 0) {
|
||||
return 0
|
||||
}
|
||||
|
||||
return Math.min(index, count - 1)
|
||||
}
|
||||
|
||||
/**
|
||||
* 라이브 모드 미디어 슬래시 명령 처리 중 지연 commit을 무시할지 확인한다.
|
||||
* @param {Object} options - 판별 옵션
|
||||
|
||||
Reference in New Issue
Block a user