"...git@developer.sourcefind.cn:wangsen/paddle_dbnet.git" did not exist on "4831431fc600049c8445f78797c9aa2dc5f8af55"
Unverified Commit 98ae4bbf authored by missionfloyd's avatar missionfloyd Committed by GitHub
Browse files

Remove brackets if weight == 1

parent 0be92710
...@@ -128,8 +128,13 @@ app.registerExtension({ ...@@ -128,8 +128,13 @@ app.registerExtension({
// Increment the weight // Increment the weight
const weightDelta = event.key === "ArrowUp" ? delta : -delta; const weightDelta = event.key === "ArrowUp" ? delta : -delta;
const updatedText = selectedText.replace(/(.*:)(\d+(\.\d+)?)(.*)/, (match, prefix, weight, _, suffix) => { const updatedText = selectedText.replace(/\((.*):(\d+(?:\.\d+)?)\)/, (match, text, weight) => {
return prefix + incrementWeight(weight, weightDelta) + suffix; weight = incrementWeight(weight, weightDelta);
if (weight == 1) {
return text;
} else {
return `(${text}:${weight})`;
}
}); });
inputField.setRangeText(updatedText, start, end, "select"); inputField.setRangeText(updatedText, start, end, "select");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment