nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: nvim-lua/plenary.nvim
Pull request #633 (2024-11-28 10:55:45)

curl: Fix response status parsing
The response headers can have multiple steps in them, example:

"HTTP/1.1 200 Connection established",
"",
"HTTP/1.1 400 Bad Request",
"Content-Security-Policy: default-src 'none'; sandbox", "Content-Type: text/plain; charset=utf-8",
"Strict-Transport-Security: max-age=31536000",
"X-Content-Type-Options: nosniff",

before this would be reported as 200 incorrectly instead of 400 bad request. this fixes that issue


Patch:
diff --git a/lua/plenary/curl.lua b/lua/plenary/curl.lua
index b7fc997..20e8cc2 100644
--- a/lua/plenary/curl.lua
+++ b/lua/plenary/curl.lua
@@ -251,15 +251,25 @@ end
 ------------------------------------------------------------
 parse.response = function(lines, dump_path, code)
   local headers = P.readlines(dump_path)
-  local status = tonumber(string.match(headers[1], "([%w+]%d+)"))
-  local body = F.join(lines, "\n")
+  local status = nil
+  local processed_headers = {}
+
+  -- Process headers in a single pass
+  for _, line in ipairs(headers) do
+    local status_match = line:match "^HTTP/%S*%s+(%d+)"
+    if status_match then
+      status = tonumber(status_match)
+    elseif line ~= "" then
+      table.insert(processed_headers, line)
+    end
+  end
 
+  local body = F.join(lines, "\n")
   vim.loop.fs_unlink(dump_path)
-  table.remove(headers, 1)
 
   return {
-    status = status,
-    headers = headers,
+    status = status or 0,
+    headers = processed_headers,
     body = body,
     exit = code,
   }
diff --git a/lua/plenary/job.lua b/lua/plenary/job.lua
index 44a7348..7f54971 100644
--- a/lua/plenary/job.lua
+++ b/lua/plenary/job.lua
@@ -361,7 +361,7 @@ local on_output = function(self, result_key, cb)
         cb(err, result_line, self)
       end
 
-      if data == nil or is_complete then
+      if is_complete then
         return
       end
 


Test patch:
diff --git a/tests/plenary/job_spec.lua b/tests/plenary/job_spec.lua
index d9213be..c2edde0 100644
--- a/tests/plenary/job_spec.lua
+++ b/tests/plenary/job_spec.lua
@@ -99,7 +99,7 @@ describe("Job", function()
       assert.are.same(job:result(), results)
     end)
 
-    pending("should split stdin across newlines with no ending newline", function()
+    it("should split stdin across newlines with no ending newline", function()
       local results = {}
       local job = Job:new {
         -- writer = "hello\nword\nthis is\ntj",
@@ -113,6 +113,8 @@ describe("Job", function()
       job:start()
       job:send "hello\nwor"
       job:send "ld"
+
+      wait_for_result(job, { "hello", "world" })
       job:shutdown()
 
       assert.are.same(job:result(), { "hello", "world" })
@@ -137,7 +139,7 @@ describe("Job", function()
       assert.are.same(job:result(), results)
     end)
 
-    pending("should return last line when there is no ending newline", function()
+    it("should return last line when there is no ending newline", function()
       local results = {}
       local job = Job:new {
         command = "printf",
Repository: nvim-lua/plenary.nvim
Pull request #635 (2024-12-13 12:31:44)

fix: process all data on_output, even when not terminated with newline
The current condition prematurely quits processing of data in on_output
in some edge-cases.

In these cases `job:result()` will have all data, but not everyting was
sent through the `on_output` pipes.

Closes https://github.com/nvim-lua/plenary.nvim/issues/634

Thanks for your support, please let me know your thoughts!

msvechla: @Conni2461 could you please trigger the CI for this? I re-enabled two related pending tests and they looked good locally.

Thanks a lot for your support!

Patch:
diff --git a/lua/plenary/job.lua b/lua/plenary/job.lua
index 44a7348..7f54971 100644
--- a/lua/plenary/job.lua
+++ b/lua/plenary/job.lua
@@ -361,7 +361,7 @@ local on_output = function(self, result_key, cb)
         cb(err, result_line, self)
       end
 
-      if data == nil or is_complete then
+      if is_complete then
         return
       end
 


Test patch:
diff --git a/tests/plenary/job_spec.lua b/tests/plenary/job_spec.lua
index d9213be..c2edde0 100644
--- a/tests/plenary/job_spec.lua
+++ b/tests/plenary/job_spec.lua
@@ -99,7 +99,7 @@ describe("Job", function()
       assert.are.same(job:result(), results)
     end)
 
-    pending("should split stdin across newlines with no ending newline", function()
+    it("should split stdin across newlines with no ending newline", function()
       local results = {}
       local job = Job:new {
         -- writer = "hello\nword\nthis is\ntj",
@@ -113,6 +113,8 @@ describe("Job", function()
       job:start()
       job:send "hello\nwor"
       job:send "ld"
+
+      wait_for_result(job, { "hello", "world" })
       job:shutdown()
 
       assert.are.same(job:result(), { "hello", "world" })
@@ -137,7 +139,7 @@ describe("Job", function()
       assert.are.same(job:result(), results)
     end)
 
-    pending("should return last line when there is no ending newline", function()
+    it("should return last line when there is no ending newline", function()
       local results = {}
       local job = Job:new {
         command = "printf",
Repository: nvim-lualine/lualine.nvim
Pull request #835 (2022-09-10 16:23:58)

fix: display virtual column number in location component
In location component, display screen column number, not byte length.
This is relevant for lines containing non-latin symbols.

The same issue https://github.com/nvim-lualine/lualine.nvim/issues/362 was already fixed once, but then it was broken again.


Patch:
diff --git a/lua/lualine/components/location.lua b/lua/lualine/components/location.lua
index 413bf9e..1b276ac 100644
--- a/lua/lualine/components/location.lua
+++ b/lua/lualine/components/location.lua
@@ -2,7 +2,7 @@
 -- MIT license, see LICENSE for more details.
 local function location()
   local line = vim.fn.line('.')
-  local col = vim.fn.col('.')
+  local col = vim.fn.virtcol('.')
   return string.format('%3d:%-2d', line, col)
 end
 


Test patch:
diff --git a/tests/spec/component_spec.lua b/tests/spec/component_spec.lua
index d0a2cc2..48c1990 100644
--- a/tests/spec/component_spec.lua
+++ b/tests/spec/component_spec.lua
@@ -405,6 +405,12 @@ describe('Location component', function()
     assert_component('location', opts, ' 10:1 ')
     vim.api.nvim_win_set_cursor(0, {5, 0})
     assert_component('location', opts, '  5:1 ')
+    -- test column number
+    vim.cmd('normal! oTest')
+    assert_component('location', opts, '  6:4 ')
+    -- test column number in line containing cyrillic symbols
+    vim.cmd('normal! oТест')
+    assert_component('location', opts, '  7:4 ')
     vim.cmd('bdelete!')
   end)
 end)