Skip to content

Instantly share code, notes, and snippets.

@smashwilson
Created March 21, 2014 21:39
Show Gist options
  • Save smashwilson/9697054 to your computer and use it in GitHub Desktop.
Save smashwilson/9697054 to your computer and use it in GitHub Desktop.
wat
[x, ourRef, ourText, theirText, theirRef] = m.match
console.log "Match range: #{m.range}"
[baseRow, baseCol] = m.range.start.toArray()
console.log "baseRow = #{baseRow}, baseCol = #{baseCol}"
ourLines = ourText.split /\n/
ourRowStart = baseRow + 1
ourRowEnd = ourRowStart + ourLines.length - 1
console.log "baseRow = #{baseRow}, ourRowStart = #{ourRowStart}"
ourBannerMarker = editor.markBufferRange(
[[baseRow, 0], [ourRowStart, 0]])
console.log "ourBannerMarker = #{ourBannerMarker.getBufferRange().toString()}"
Match range: [(0, 0) - (14, 0)] conflict.coffee:36
baseRow = 0, baseCol = 0 conflict.coffee:38
baseRow = 0, ourRowStart = 1 conflict.coffee:44
ourBannerMarker = [(8, 0) - (13, 0)] conflict.coffee:47
Object
ourBannerMarker: "[(13, 0) - (14, 0)]"
ourRef: "[(13, 0) - (14, 0)]"
separatorRef: "[(7, 0) - (8, 0)]"
theirBannerRef: "[(13, 0) - (14, 0)]"
theirRef: "[(8, 0) - (13, 0)]"
__proto__: Object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment