更新换行算法和APP-PUSH
This commit is contained in:
22
client/src/features/textWrap/breakpoints/enCandidates.ts
Normal file
22
client/src/features/textWrap/breakpoints/enCandidates.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import type { Breakpoint } from './types';
|
||||
import type { Token } from '../core/types';
|
||||
|
||||
/**
|
||||
* EN 候选断点生成(极简派)
|
||||
*
|
||||
* 口径:
|
||||
* - tokens 仅为 WORD(不包含 SPACE token)
|
||||
* - 候选断点只生成在 `pos ∈ [1, N-1]`
|
||||
* - kind 固定为 SPACE,priority 固定为 10
|
||||
*/
|
||||
export function generateEnCandidates(tokens: Token[]): Breakpoint[] {
|
||||
const n = tokens.length;
|
||||
if (n <= 1) return [];
|
||||
|
||||
const out: Breakpoint[] = [];
|
||||
for (let pos = 1; pos <= n - 1; pos++) {
|
||||
out.push({ pos, kind: 'SPACE', priority: 10 });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user