Commits

Lynn Rees  committed ba98131

- "wikdNode" delete* handles "Cancel" properly

  • Participants
  • Parent commits 15f1e8e
  • Tags 0.4.2

Comments (0)

Files changed (3)

File scripts/deleteFirstChars.groovy

 import org.apache.commons.lang.StringUtils as SU
 
 def trimPrompt(String pattern, Boolean start, String msg) {
-	def mark = Pattern.quote(ui.showInputDialog(node.delegate, msg, ''))
-	mark = mark ? mark : ''
-	mark = start ? pattern + mark : mark + pattern
+	def mark = ui.showInputDialog(node.delegate, msg, '')
+	if (mark != null) {
+	   mark = Pattern.quote(start ? pattern + mark : mark + pattern)
+	}
 	c.selecteds.every { it.text = SU.trim( it.plainText.replaceFirst(mark, '')) }
 }
 trimPrompt('^{1}', true, 'Enter characters to delete from text start...')

File scripts/deleteLastChars.groovy

 import org.apache.commons.lang.StringUtils as SU
 
 def trimPrompt(String pattern, Boolean start, String msg) {
-	def mark = Pattern.quote(ui.showInputDialog(node.delegate, msg, ''))
-	mark = mark ? mark : ''
-	mark = start ? pattern + mark : mark + pattern
+	def mark = ui.showInputDialog(node.delegate, msg, '')
+	if (mark != null) {
+	   mark = Pattern.quote(start ? pattern + mark : mark + pattern)
+	}
 	c.selecteds.every { it.text = SU.trim( it.plainText.replaceFirst(mark, '')) }
 }
 trimPrompt('{1}$', false, 'Enter characters to delete from text end:')

File shared/delete.groovy

 import org.apache.commons.lang.StringUtils as SU
 
 def trimPrompt(String pattern, Boolean start, String msg) {
-	def mark = Pattern.quote(ui.showInputDialog(node.delegate, msg, ''))
-	mark = mark ? mark : ''
-	mark = start ? pattern + mark : mark + pattern
+	def mark = ui.showInputDialog(node.delegate, msg, '')
+	if (mark != null) {
+	   mark = Pattern.quote(start ? pattern + mark : mark + pattern)
+	}
 	c.selecteds.every { it.text = SU.trim( it.plainText.replaceFirst(mark, '')) }
 }