From b9fb524a740e9e3948e2f5331a0d2576c3db1c10 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke <marijnh@gmail.com>
Date: Wed, 31 Oct 2012 19:27:11 +0100
Subject: [PATCH] Don't assume character 0 has x coordinate 0

Closes #921
---
 lib/codemirror.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/codemirror.js b/lib/codemirror.js
index 2bbaaea62..94593d3e6 100644
--- a/lib/codemirror.js
+++ b/lib/codemirror.js
@@ -1002,7 +1002,7 @@ window.CodeMirror = (function() {
     }
 
     var bidi = getOrder(lineObj), dist = lineObj.text.length;
-    var from = lineLeft(lineObj), to = lineRight(lineObj), fromX = 0, toX;
+    var from = lineLeft(lineObj), to = lineRight(lineObj), fromX = paddingLeft(cm.display), toX;
     if (!bidi) {
       // Guess a suitable upper bound for our search.
       var estimated = Math.min(to, Math.ceil((x + Math.floor(innerOff / textHeight(cm.display)) *
-- 
GitLab