diff options
| author | Opportunity <[email protected]> | 2020-01-19 09:52:19 +0800 |
|---|---|---|
| committer | Opportunity <[email protected]> | 2020-01-19 13:01:09 +0800 |
| commit | b22274761d5370abfcb868b001d72f0456e4a34d (patch) | |
| tree | 92fcb5f78fa5554dc66572b1176da6be95503088 | |
| parent | 03fde30e800970b004863d32ace885556d3346b4 (diff) | |
fix
| -rw-r--r-- | xmake/core/base/text.lua | 6 | ||||
| -rw-r--r-- | xmake/modules/private/utils/complete.lua | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/xmake/core/base/text.lua b/xmake/core/base/text.lua index 38f6912d9..cd7c889c5 100644 --- a/xmake/core/base/text.lua +++ b/xmake/core/base/text.lua @@ -44,13 +44,15 @@ function text._lastwbr(str, width, wordbreak) end local range = str:sub(1, width) - local poss = range:reverse():find("[%s-]") + local range_r = range:reverse() + -- break at spaces and '-'' first, then try other candidates + local poss = range_r:find("[%s-]") or range_r:find("[%%=%)]") if poss then return #range - poss + 1 end -- not found in range, try afterwards - poss = str:find("[%s-]", width + 1) + poss = str:find("[%s-%%=%)]", width + 1) if poss then return poss end diff --git a/xmake/modules/private/utils/complete.lua b/xmake/modules/private/utils/complete.lua index 781e98367..88b7d6ce4 100644 --- a/xmake/modules/private/utils/complete.lua +++ b/xmake/modules/private/utils/complete.lua @@ -282,7 +282,7 @@ function main(pos, config, ...) _complete(argv, "") else local completing = table.remove(argv) - _complete(argv, completing) + _complete(argv, completing or "") end end |
